package acwing_01;

import java.io.*;
import java.util.StringTokenizer;

public class _789_使用快读快写 {
	static int N = 100000;
	static int n;
	static int q;
	static int arr[] = new int[N];
	static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		n = Integer.parseInt(st.nextToken());
		q = Integer.parseInt(st.nextToken());

		st = new StringTokenizer(br.readLine());
		
		// 初始化数组
		for (int i = 0; i < n; i++) {
			arr[i] = Integer.parseInt(st.nextToken());
		}
		
		// 查询元素
		for (int i = 0; i < q; i++) {
			check(Integer.parseInt(br.readLine()));
		}
		
		bw.flush();
		
	}

	public static void check(int k) throws IOException{
		int l = 0;
		// 边界！
		int r = n - 1;
		int start;
		int end;
		int mid;
		while (l <= r) {
			mid = l + r >> 1; // 等同于 (l+r)/2 测试了下用不用>>的执行速度，没区别
			if (arr[mid] == k) {
				start = mid;
				end = mid;
				// 判断后面是否还有相同元素
				while (true) {
					// 边界！
					if (end + 1 >= n) {
						break;
					}
					if (arr[++end] == k) {
						continue;
					} else {
						--end;
						break;
					}
				}
				// 判断前面是否有相同元素
				while (true) {
					// 边界！
					if (start - 1 < 0) {
						break;
					}
					if (arr[--start] == k) {
						continue;
					} else {
						++start;
						break;
					}
				}
				bw.write(start + " " + end + "\n");
				return;
			} else if (k > arr[mid]) {
				l = mid + 1;
			} else {
				r = mid - 1;
			}

		}
		// 没找到
		bw.write("-1 -1\n");
		return;

	}
}
